<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;
use think\model\concern\SoftDelete;

/**
 * @property bool $status 审核状态:1=待审核,2=通过,3=驳回
 * @property float $amount 提现金额
 * @property float $fee 手续费
 * @property float $real_amount 到账金额
 * @property int $bank_id 银行卡
 * @property int $id
 * @property int $user_id 用户
 * @property string $createtime
 * @property string $order_sn 订单编号
 * @property-read \app\model\UserBank $bank
 * @property-read mixed $status_text
 * @mixin \think\Model
 */
class UserWithdraw extends Model
{

	//
	protected $createTime = 'createtime';
	
	protected $append = [
		'status_text'
	];
	function bank()
	{
		return $this->belongsTo(UserBank::class,'bank_id');
	}
	
	public function getStatusTextAttr($value, $data)
	{
		$value = $value ? $value : ($data['status'] ?? '');
		$list = ['1' => '待审核', '2' => '通过', '3' => '驳回'];
		return $list[$value] ?? '';
	}
}
